/**
 * @author Zvonimir Fras <zvonimir@frasbros.com>
 */


#ifndef RUMAINWINDOW_H
#define RUMAINWINDOW_H

#include <QMainWindow>

#include "ui_RUMainWindow.h"
#include "neuralnetwork.h"
#include "pso.h"
#include "psorunner.h"


#define ANN_INPUT_SIZE 256
#define ANN_OUTPUT_SIZE 2

#define IMAGE_WIDTH 64



class RUMainWindow : public QMainWindow, Ui::RUMainWindow
{
   Q_OBJECT
   
   public:
      RUMainWindow( QWidget *parent = 0 );
      
   public slots:
      void on_action_Open_Training_Set_triggered();
      void on_action_Open_Network_triggered();
      void on_action_Save_Network_triggered();
      void on_image1Button_clicked();
      void on_image2Button_clicked();
      void on_compareButton_clicked();
      
      void on_openTestSetFolderButton_clicked();
      
      void on_createButton_clicked();
      void on_trainButton_clicked();
      
      void on_testButton_clicked();
      
      void slotOptimizingFinnished();
      
      void log( const QString &log );
      void logTest( const QString &log );
      
      
      void slotOpenTrainingSet( const QString &trainingSetPath );
      
   private:
      NeuralNetwork m_ann;
      
      QList< int > m_networkStructure;
      Pso m_pso;
      PsoRunner m_runner;
      
      QString m_readNextLine( QFile &file );
      
      QList< float > m_imagesToNeuralNetworkInput( const QImage &image1, const QImage &image2 );
      QList< float > m_imageFeatures( const QImage &image );
};

#endif // RUMAINWINDOW_H
